/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.mes.base.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.mes.base.entity.DictTreeNode;
import org.springblade.modules.mes.base.entity.MaterialInfo;
import org.springblade.modules.mes.base.vo.MaterialInfoVO;

import java.util.Date;
import java.util.List;

/**
 * 材料信息（材料库） Mapper 接口
 *
 * @author BladeX
 * @since 2020-09-14
 */
public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param materialInfo
	 * @return
	 */
	List<MaterialInfoVO> selectMaterialInfoPage(IPage page, @Param("materialInfo") MaterialInfoVO materialInfo);

	List<MaterialInfoVO> getQuaMaterialInfoPage(IPage page, @Param("entity") MaterialInfoVO materialInfo);

	/**
	 * 不分页
	 * 过滤掉材料状态为 7-暂停 的
	 *
	 * @param materialInfo
	 * @return
	 */
	List<MaterialInfoVO> selectMaterialInfoList(@Param("materialInfo")MaterialInfoVO materialInfo);

	/**
	 * 根据材料名称模糊搜索原材料
	 * @param materialInfo
	 * @return
	 */
	List<MaterialInfoVO> selectRawMaterialList(@Param("materialInfo")MaterialInfoVO materialInfo);

	/**
	 * 根据更新时间查询材料列表，包含已删除的
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	List<MaterialInfo> listWithDeleted(Date startTime, Date endTime);


    List<MaterialInfoVO> getMaterialList(MaterialInfoVO materialInfo);

    /**
     * 获取产品/物料信息
     * @param materialInfo
     * @return
     */
    List<MaterialInfoVO> getMaterialInfo(MaterialInfoVO materialInfo);

	List<MaterialInfo> getMaterialInfos(String tenantId);

	List<MaterialInfoVO> getMaterialLists(@Param("entity") MaterialInfoVO materialInfo);

    List<String> selectMaterialNo(String tenantId);

	List<String> selectMaterialName(String tenantId);

    List<MaterialInfoVO> getMaterialInfoByQuality(@Param("materialInfo")MaterialInfoVO materialInfo);

    List<MaterialInfoVO> fisMaterialList(@Param("materialInfo") MaterialInfoVO materialInfo);

    List<MaterialInfo> materialListByIdList(@Param("idList") List<Long> longList);

    List<MaterialInfo> materialListByNoList(@Param("materialNoList") List<String> materialNoList);

    List<MaterialInfo> selectMaterialInfoByPatrol(@Param("entity") MaterialInfoVO materialInfo);

//    List<MetrologyProduct> getMaterialInfoByNos(List<MetrologyProduct> metrologyProducts);

	List<DictTreeNode> getTree(@Param("code") String code, @Param("dictKeys") List<String> dictKeys);

}
